package com.lmf.boot.controller;

import com.lmf.boot.bean.Car;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


//@Controller
//@ResponseBody  //表示每一个方法返回的数据都是直接写给浏览器的，而不是跳转某个页面

@RestController //可以同时代替 “@Controller”，“@ResponseBody” 这两个注解
public class HelloController {

    @Autowired
    private Car car;

    @RequestMapping("/hello")
    public String handle01(){
        return "hello,SpringBoot! 刘明福";
    }

    @RequestMapping("/car")
    public Car handle02(){
        return car;
    }
}
